package org.pinda.network;


public class ServerInfo {
	
	private byte[] ipAddress;
	private short port;
	private String roomName;
	private byte currentPlayers;
	private byte maxPlayers;
	
	public ServerInfo(byte[] ipAddress, short port, String roomName, int currentPlayers, int maxPlayers) {
		this.ipAddress = ipAddress;
		this.port = port;
		this.roomName = roomName;
		this.currentPlayers = (byte)currentPlayers;
		this.maxPlayers = (byte)maxPlayers;
	}
	
	/**
	 * The length in bytes to send this information
	 * @return bytes needed
	 */
	public int getLength() {
		return 4 /* IP */ + PacketUtils.packetLengthString(roomName) + 1 /* Current Players */ + 1 /* Max Players */ + 2 /* Port */;
	}
	
	public byte[] getIP() {
		return ipAddress;
	}
	
	public short getPort() {
		return port;
	}
	
	public byte getCurrentPlayerCount() {
		return currentPlayers;
	}
	
	public byte getMaxPlayerCount() {
		return maxPlayers;
	}
	
	public String getRoomName() {
		return roomName;
	}

}
